package config

import (
	"github.com/spf13/viper"
)

type Config struct {
	Mysql struct {
		User     string
		Password string
		Host     string
		Port     int
		Database string
	}
	Redis struct {
		Host     string
		Password string
		Db       int
	}
}

var AppConfig Config

func Init() {
	viper.SetConfigFile("D:\\student\\gowork\\src\\five\\zk\\run\\srv-server\\basic\\config\\dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic("读取失败")
	}
	err = viper.Unmarshal(&AppConfig)
	if err != nil {
		panic("解析失败")
	}
}
